package com.sqfw.project.wp.publish;

import org.apache.cxf.endpoint.Client;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/jaxws")
public class ThirdwebController {

    @RequestMapping("/client")
    public String jaxWsDynamicClient() {
        JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();
        Client client = clientFactory.createClient("http://192.168.3.36:8091/ws/thirdwebService?wsdl");
        Object[] objects;
        String info = "<?xml version='1.0' encoding='UTF-8'?>" +
                "<Request>" +
                "<param name=\"WPID\">20250907017790</param>"+
                "<param name=\"START_TIME\">2018-09-07 15:20:25</param>"+
                "<param name=\"SEND_TIME\">2025-02-06 13:23:11</param>"+
                "<param name=\"MESSAGE\">请相关部门核实处理</param>"+
                "<param name=\"CALLNUM\">56748293 </param>"+
                "<param name=\"WP_TYPE\">投诉举报类</param>"+
                "<param name=\"CLASS1\">建设交通类</param>"+
                "<param name=\"CLASS2\">城管执法</param>"+
                "<param name=\"CLASS3\">物业相关执法</param>"+
                "<param name=\"CLASS4\">房屋结构破坏</param>"+
                "<param name=\"NEW_CLASS1\">建设交通类</param>"+
                "<param name=\"NEW_CLASS2\">城管执法</param>"+
                "<param name=\"NEW_CLASS3\">物业相关执法</param>"+
                "<param name=\"NEW_CLASS4\">房屋结构破坏</param>"+
                "<param name=\"NEW_CLASS5\">房屋结构破坏</param>"+
                "<param name=\"SUMMARY\">市民来电反映：上述地址在装修房屋将承重墙全部敲掉，物业上门被告知不听物业，只听业主的，业主表示敲掉就全部敲掉，其表示影响到整个房屋结构，诉求：希望管理部门核实制止并回复原样。</param>"+
                "<param name=\"REL_NAME\">孙先生</param>"+
                "<param name=\"REL_PHONENO\">56748293</param>"+
                "<param name=\"REL_DISTRICT\">1149</param>"+
                "<param name=\"REL_ADDRESS\">宝山区通河八村68号401室</param>"+
                "<param name=\"SUPERVISION\">0</param>"+
                "<param name=\"DEPT_LEVEL2\">257</param>"+
                "<param name=\"PRIORITY\">0</param>"+
                "<param name=\"TIME_BOUNDRY\">2018-09-29 15:20:00</param>"+
                "<param name=\"WP_SOURCE\">1</param>"+
                "<param name=\"NOTE\"></param>"+
                "<param name='NOT_REASON'>"+"未联系原因"+"</param>"+
                "</Request>";
        String result = null;
        try {
            objects = client.invoke("getInfo", info);
            if (objects != null) {
                result = (String) objects[0];
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
        return result;
    }
}
